<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>


<chiptrack:checkLogon sourcePage="/searchDropShipmentPS.do"/>
<%@ page import="com.scalar.chiptrack.utils.ConfigManager,java.util.ArrayList"%>
<%String chipTracContext = "/" + ConfigManager.getChipTracContext();%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML><HEAD><TITLE>Scalarsoft - Chip Trac</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type=text/css rel=stylesheet>

<META content="MSHTML 5.50.4807.2300" name=GENERATOR></HEAD>
<BODY bgColor="#ffffff" leftMargin=0 topMargin=0 marginheight="0" marginwidth="0">
<script src="<%=chipTracContext%>/jsp/includes/scripts/validations.js"></script>

<SCRIPT language="JavaScript">
	function searchPackingSlips()
	{ 
		document.searchDropShipmentPSForm.searchSalesOrderId.value = document.searchDropShipmentPSForm.searchSalesOrderId.value.trim();
		document.searchDropShipmentPSForm.searchPo.value = document.searchDropShipmentPSForm.searchPo.value.trim();
		document.searchDropShipmentPSForm.action="<%=chipTracContext%>/searchDropShipmentPS.do?action=dsSearch";
		document.searchDropShipmentPSForm.submit();
	}
	function searchAllPackingSlips()
	{
		document.searchDropShipmentPSForm.searchSalesOrderId.value = document.searchDropShipmentPSForm.searchSalesOrderId.value.trim();
		document.searchDropShipmentPSForm.searchPo.value = document.searchDropShipmentPSForm.searchPo.value.trim();
		document.searchDropShipmentPSForm.status.value='OPEN';
		document.searchDropShipmentPSForm.action="<%=chipTracContext%>/searchDropShipmentPS.do?action=dsSearch";
		document.searchDropShipmentPSForm.submit();
	}


	function loadSalesOrder(salesOrderId) {    
		document.searchDropShipmentPSForm.action = "<%=chipTracContext%>/dropShipmentPS.do?action=loadSalesOrder&salesOrderId=" + salesOrderId;
		document.searchDropShipmentPSForm.submit();    
	}

	function showSalesOrder( salesOrderNo )
	{
		newWindow = window.open ('<%=chipTracContext%>/order.do?action=salesOrderView&salesOrderNo=' + salesOrderNo,'pendingSalesOrderView','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=yes,width=850,height=600,resizable=yes');
		newWindow.focus();
	}

	function showErrorReportPage()
	{
		newWindow = window.open ('<%=chipTracContext%>/reportProblem.do','reportProblem','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=no,width=750,height=400,resizable=no');
		newWindow.focus();
	}

	function viewPackingSlip(salesOrderId) {
		document.searchDropShipmentPSForm.action = "<%=chipTracContext%>/dropShipmentPS.do?action=view&customerShippingId=" + salesOrderId ;    
		document.searchDropShipmentPSForm.submit();    
	}
</SCRIPT>

<!-- Top Header Start-->
<%@ include file="/jsp/includes/header.jsp" %>
<!-- Top Header End-->

<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
  <TBODY>
  <TR>
	<td width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>

<!-- Side Navigation start -->
	<%@ include file="/jsp/operations/operations_menu.jsp" %>
</TD>
<!-- end of the side navigations -->
<TD bgcolor="#ffffff">
<IMG height=9 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8></TD>
<TD bgcolor="#ffffff"><IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></TD>
<TD valign="top" width="100%">

<IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0>
<BR>
<!-- from here your body starts -->

<html:form method="post" action="/searchDropShipmentPS" type="com.scalar.chiptrack.operations.packingslip.forms.searchDropShipmentPSForm" onsubmit="javascript:searchPackingSlips();" >
<center><span class="NArialW">Drop Shipment Packing Slip</span></center>
<img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=20>
<%
    ArrayList soIdList = (ArrayList) request.getAttribute("SalesOrderList");
%>
<table border="0" width="90%" align=right >
 <tr><td>
  <table border="0" width="100%" align=right>  
  <!--tr><td colspan=5><chiptrack:errors styleClass="NArialL"/></td></tr-->
  <tr><td colspan=5><chiptrack:errors styleClass="NArialL"/></td></tr>
  <tr><td colspan=5><chiptrack:info styleClass="NArialL"/>
  <%
        String salesOrderNo = ( String ) request.getAttribute( "SALES_ORDER_NO_FOR_SALES_ORDER_LINK" );
        if( ( salesOrderNo != null ) && ( salesOrderNo.trim().length() != 0 ) ) {
  %>
    <font class='NArialL'><font color='green'>... View the <a href="javascript:showSalesOrder('<%=salesOrderNo%>')">Sales Order</a></font></font>
  <%}%>
  </td></tr>
  <tr><td colspan=5><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10></td></tr>

  <tr>

   <td width="25%"><font class="NArialL">Sales Order #</font></td>
      <td width="20%"><font class="NArialL">
      	<html:text name="searchDropShipmentPSForm" property="searchSalesOrderId" styleClass="txfield"/>
      </td>
      <td width="5%">&nbsp;</td>
      <td width="25%" class="NArialL">Customer Name </td>
      <td width="20%">          
	<html:select name="searchDropShipmentPSForm"  property="customerId" styleClass="txfield">
	<html:options collection="customerList" property="value" labelProperty="label"/>
	</html:select>      	
	</td>
    </tr>
    <tr>
      <td width="25%"><font class="NArialL">Customer PO #</font></td>
      <td width="20%"><font class="NArialL">
      	<html:text name="searchDropShipmentPSForm" property="searchPo" styleClass="txfield"/>
      </td>
      <td width="5%">&nbsp;</td>
      <td width="15%"><font class="NArialL">Packing Slip Status</font></td>
      <td width="25%"><font class="NArialL">
        <html:select name="searchDropShipmentPSForm" property="status" styleClass="txfield">
                <html:option value="0">All</html:option>
                <html:option value="OPEN"> OPEN </html:option>
                <html:option value="ISSUED"> ISSUED </html:option>
         </html:select>
      </td>
      <td width="15%">&nbsp;</td>
    </tr>
    <tr><td colspan='6'><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=20></TD></TR>
	<tr><td colspan='6' class="NArialL"><Font color='blue'><li>Cancelled and Shipped Drop Shipments can be viewed from Packing Slip</font></TD></TR>
    <tr>
     <td colspan=2 align=left  class="NArialL">Click here to 
    	  <a href="javascript:searchAllPackingSlips();">Generate</a> Drop Shipment Packing slip
      </td>   
      <td colspan=3 align=left>
    	  <a href="javascript:searchPackingSlips();">
    	    <input type=image border="0" src="<%=chipTracContext%>/jsp/includes/images/search.gif" width="53" height="17"></a>  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          <a href="javascript:document.searchDropShipmentPSForm.reset();"><img border="0" src="<%=chipTracContext%>/jsp/includes/images/reset.gif" width="53" height="17"></a>
      </td>
    </tr>
   
  </table>
  </td></tr>
  <tr><td><img height=10 src="images/spacer.gif"></td></tr>
   <tr><td>  	      
   <logic:equal name="showList" value="TRUE">
   <table border="0" width="100%" bordercolor="#FFFFFF" align=right>
	<tr>          
	  <td width="10%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Sales Order #</font></td>
          <td width="20%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Customer Name</font></td>
          <td width="25%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Customer PO #</font></td>          
	  <td width="25%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Inv No</font></td>          
	  <td width="10%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Status</font></td>
	  <td width="10%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Actions</font></font></td>
	</tr>
        <% int bgcount = 0;%>
        <tr><td colspan=5><chiptrack:messages type="error" styleClass="NArialL" /></td></tr>
	<logic:iterate id="PackingSlip" name="searchList">
        <% bgcount = bgcount + 1; %>
	<tr>
          <td width="10%" <%if(bgcount%2==0){%> bgcolor='#DEE1E2' <% } else {%> bgcolor='#FFFFEE' <%}%>><font class="NArialL"><bean:write name="PackingSlip" property="salesOrderNo"/></font></td>
	  <td width="20%" <%if(bgcount%2==0){%> bgcolor='#DEE1E2' <% } else {%> bgcolor='#FFFFEE' <%}%>><font class="NArialL"><bean:write name="PackingSlip" property="customerName"/></font></td>
          <td width="25%" <%if(bgcount%2==0){%> bgcolor='#DEE1E2' <% } else {%> bgcolor='#FFFFEE' <%}%>><font class="NArialL"><bean:write name="PackingSlip" property="customerPoNo"/></font></td>          
	  <td width="25%" <%if(bgcount%2==0){%> bgcolor='#DEE1E2' <% } else {%> bgcolor='#FFFFEE' <%}%>><font class="NArialL"><bean:write name="PackingSlip" property="invNo"/></font></td>
          <td width="10%" <%if(bgcount%2==0){%> bgcolor='#DEE1E2' <% } else {%> bgcolor='#FFFFEE' <%}%>><font class="NArialL"><bean:write name="PackingSlip" property="status"/></font></td>
	  <td width="10%" <%if(bgcount%2==0){%> bgcolor='#DEE1E2' <% } else {%> bgcolor='#FFFFEE' <%}%>><font class="NArialL">
			<logic:equal name="PackingSlip" property="status" value="OPEN">
                <A Href='javascript:loadSalesOrder(<bean:write name="PackingSlip" property="salesOrderId"/>)'>Generate</A>
            </logic:equal>

			<logic:equal name="PackingSlip" property="status" value="ISSUED">
                <A Href='javascript:viewPackingSlip(<bean:write name="PackingSlip" property="customerShippingId"/>)'>View/Modify</A>
            </logic:equal>
          </td>
	</tr>
        </logic:iterate>
    </table>
    </logic:equal>
      </table>
  </td></tr>
</table>
</html:form>

<!-- till here -->
</TD>
<TD bgcolor="#ffffff"><IMG height=1 src="images/spacer.gif" width=1></TD>
</TR>
</TABLE>
<!-- Footer starts here -->

<%@ include file="/jsp/includes/footer.jsp" %>

<!-- footer end here -->

</BODY>
</HTML>
